import { getRequest } from '@/api/interceptor'
import { transAlbumDetail } from '@/api/album/translate'
import { translateComment, translateLastComment } from '@/api/video/translate'

const REQUEST_URL = {
  detail: '/album',
  comment: '/comment/album',
  count: '/album/detail/dynamic'
}

export const getAlbumDetail = (id) => {
  return getRequest(REQUEST_URL.detail, { id }).then(transAlbumDetail)
}

export const getAlbumCount = (id) => {
  return getRequest(REQUEST_URL.count, { id })
}

export const getAlbumComment = ({ id, limit }) => {
  return getRequest(REQUEST_URL.comment, { id, limit }).then(translateComment)
}

export const getLastestAlbumComment = ({ id, limit, offset }) => {
  return getRequest(REQUEST_URL.comment, { id, limit, offset: offset * limit }).then(translateLastComment)
}
